<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>秒杀表的后台管理</title>
    <script type="text/javascript" src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
</head>
<script type="text/javascript">
    // $(document).ready(function() {
    //     $("#open_btn").click(function () {
    //         alert("123")
    //         var obj = {"msg": "前端信息"};
    //         var myJSON = JSON.stringify(obj);
    //         console.log(myJSON);//必须传String类型的json
    //         $.ajax({
    //             type: "post",
    //             dataType: 'json',
    //             contentType: 'application/json',//必须传String类型的json 传到后端后变成JSON对象
    //             data: myJSON,
    //             success: (msg) => {//后端传的是字符串,转化为json  前端接收到的是JSON的数据
    //                 alert(msg)
    //             },
    //         })
    //     })
    // })
</script>
<body>
<thead>
<tr>
    <th>#</th>
    <th>商品编号</th>
    <th>商品名称</th>
    <th>价格</th>
    <th>库存</th>
    <th>是否参与秒杀(1参与,0不参与)</th>
</tr>
<br>
</thead>
<tbody>
<!--对SeckillActivity.records(获取的每条记录(对象)进行遍历)-->
<tr class="gradeX" th:each="good,stat:${goods.records}">
    <td th:text="${stat.count}"></td>
    <td th:text="${good.goodsId}"></td>
    <td th:text="${good.goodsName}"></td>
    <td th:text="${good.goodsPrice}">></td>
    <td th:text="${good.goodsStock}">></td>
    <td th:text="${good.isSeckill}">></td>
    <td>
        <a id="open_btn" th:href="@{/manage/openThis/{goodName}(goodName=${good.goodsName},pn=${goods.getCurrent()})}" type="button">
            开启该商品秒杀
        </a>
    </td>
    <td>
        <a id="close_btn" th:href="@{/manage/closeThis/{goodName}(goodName=${good.goodsName},pn=${goods.getCurrent()})}" type="button">
            关闭该商品秒杀
        </a>
    </td>
    <br>
</tr>
<br>
</tbody>
      当前第[[${goods.current}]]页  总计 [[${goods.pages}]]页  共[[${goods.total}]]条记录
      <ul>
        <li ><a th:href="@{/manage/goodsTable(pn=${goods.current}-1)}">← 前一页</a></li>
        <!--                            如果当前页==当前num则添加样式-->
        <li  th:each="num:${#numbers.sequence(1,goods.pages)}" >
          <a th:href="@{/manage/goodsTable(pn=${num})}">[[${num}]]</a>
        </li>
        <li ><a th:href="@{/manage/goodsTable(pn=${goods.current}+1)}" >下一页 → </a></li>
      </ul><br>
      <label style="color:red" th:text="${session.SecKillMsg}"></label><br>
      <a  th:href="@{/manage/goodsTable(pn=${goods.current})}">
          刷新页面
      </a >
      <a  th:href="@{/common/goIndex}">
          返回首页
      </a >
</body>
</html>